
import {
    DEFAULT_ALBUM_PAGE_NUM,
    DEFAULT_ALBUM_PAGE_SIZE,
} from '../services/play';

export enum Sort {
    ASC = -1,
    DESC = 1,
}

const initState = {
    albumId: '',
    hasMore: false,
    pageNum: DEFAULT_ALBUM_PAGE_NUM,
    pageSize: DEFAULT_ALBUM_PAGE_SIZE,
    sort: Sort.DESC,
    playlist: [],
    switchingTrack: null,
    currentTrack: null,
    currentIndex: 0,
};

export default {
    namespace: 'track',
    state: initState,
    effects: {
        *playTrack({ payload }, { put, call, select }) {
            debugger
        }
    },
    reducers: {
        updateTrack(state: any, { payload }: any) {
            return { ...state, ...payload };
        },
    }
}